#ifndef	_SOCKET_H_
#define	_SOCKET_H_

//#include "Types.h"

extern u8 socket(SOCKET s, u8 protocol, u16 port, u8 flag); // Opens a socket(TCP or UDP or IP_RAW mode)
extern void close(SOCKET s); // Close socket
extern u8 connect(SOCKET s, u8 * addr, u16 port); // Establish TCP connection (Active connection)
extern void disconnect(SOCKET s); // disconnect the connection
extern u8 listen(SOCKET s);	// Establish TCP connection (Passive connection)
extern u16 send(SOCKET s, const u8 * buf, u16 len); // Send data (TCP)
extern u16 recv(SOCKET s, u8 * buf, u16 len);	// Receive data (TCP)
extern u16 sendto(SOCKET s, const u8 * buf, u16 len, u8 * addr, u16 port); // Send data (UDP/IP RAW)
extern u16 recvfrom(SOCKET s, u8 * buf, u16 len, u8 * addr, u16  *port); // Receive data (UDP/IP RAW)

#ifdef __MACRAW__
void macraw_open(void);
u16 macraw_send( const u8 * buf, u16 len ); //Send data (MACRAW)
u16 macraw_recv( u8 * buf, u16 len ); //Recv data (MACRAW)
#endif

#endif
/* _SOCKET_H_ */
